﻿using System.Applications;
using System.Composition;
using Windows.ApplicationModel.Activation;
using Windows.UI.Notifications;
using Windows.UI.Xaml;


// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227

namespace HDK.Demo
{
    /// <summary>
    /// Provides application-specific behavior to supplement the default Application class.
    /// </summary>
    sealed partial class App : HDKApplication
    {
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();       
        }

        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            base.OnLaunched(args);

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            EventAggregator.Publish<CreateToastNotificationMessage>(new CreateToastNotificationMessage(new ToastNotificationData(
                string.Format("Kind:{0} PrevState:{1} TileID:{2}",args.Kind.ToString(), args.PreviousExecutionState.ToString(),args.TileId)
                )));

            //EventAggregator.GetEvent
        }

        protected override UIElement CreateShell()
        {
            var shell = new Shell(this.RegionManager);
            return shell;
        }
    }
}